#ifndef __DEVICE_IOQ_H
#define __DEVICE_IOQ_H

#include "stdint.h"
#include "thread.h"
#include "sync.h"

#define buf_size 64

struct ioq {
    struct lock lock;
    struct task_struct* producer;
    struct task_struct* consumer;
    char buf[buf_size];
    int32_t head;
    int32_t tail;
};


void ioq_init(struct ioq* pioq);
bool ioq_is_full(struct ioq* pioq);
bool ioq_is_empty(struct ioq* pioq);
char ioq_get_char(struct ioq* pioq);
void ioq_put_char(struct ioq* pioq, char ch);


#endif
